<?php

namespace app\admin\controller;

use support\View;
use app\model\SiteSetting;

class BaseController
{

    /**
     * 分页当前页数
     * @var
     */
    public $page;

    /**
     * 分页每条查询条数
     * @var
     */
    public $limit;

    /**
     * 请求方法
     * @var
     */
    public $method;

    /**
     * 中间件获取的用户信息
     * @var
     */
    public $admin_info;

    /**
     * 获取当前控制器方法
     * @var
     */
    public $action;

    public function __construct()
    {
        $this->method = request()->method();
        $this->page   = request()->post('page', 1);
        $this->limit  = request()->post('limit', 10);
        $this->action = request()->path();
        //给模板传入当前控制器和方法名，用于跳转
        View::assign('action', $this->action);
        //网站配置
        $site_info = SiteSetting::getSite();
        View::assign('site_info', $site_info);
    }

}
